using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace 阿里妈妈登录
{
	public class UUWise
	{
		private const int int_0 = 99881;
		private const int int_1 = 1004;
		private const string string_0 = "06ada1d03089445faa6aba961823b1e1";
		private bool bool_0;
		public string CheckResult(string result, int softId, int codeId, string checkKey)
		{
			if (string.IsNullOrEmpty(result))
			{
				return result;
			}
			if (result[0] == '-')
			{
				return result;
			}
			string[] array = result.Split(new char[]
			{
				'_'
			});
			string text = array[0];
			string text2 = array[1];
			string value = UUWise.MD5Encoding(softId.ToString() + checkKey + codeId.ToString() + text2.ToUpper()).ToUpper();
			if (text.Equals(value))
			{
				return text2;
			}
			return "结果校验不正确";
		}
		public string login(string string_1, string string_2)
		{
			if (IntPtr.Size == 4)
			{
				Wrapper.uu_setSoftInfo(99881, "06ada1d03089445faa6aba961823b1e1");
				if (Wrapper.uu_login(string_1, string_2) > 0)
				{
					this.bool_0 = true;
					int num = Wrapper.uu_getScore(string_1, string_2);
					return "登录成功！当前点数:[" + num + "]";
				}
				return "登录失败！";
			}
			else
			{
				Wrapper64.uu_setSoftInfo(99881, "06ada1d03089445faa6aba961823b1e1");
				if (Wrapper64.uu_login(string_1, string_2) > 0)
				{
					this.bool_0 = true;
					int num = Wrapper64.uu_getScore(string_1, string_2);
					return "登录成功！当前点数:[" + num + "]";
				}
				return "登录失败！";
			}
		}
		public static string MD5Encoding(string rawPass)
		{
			MD5 mD = MD5.Create();
			byte[] bytes = Encoding.UTF8.GetBytes(rawPass);
			byte[] array = mD.ComputeHash(bytes);
			StringBuilder stringBuilder = new StringBuilder();
			byte[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				byte b = array2[i];
				stringBuilder.Append(b.ToString("x2"));
			}
			return stringBuilder.ToString();
		}
		public string recogniseImg(Image image_0)
		{
			MemoryStream memoryStream = new MemoryStream();
			image_0.Save(memoryStream, ImageFormat.Jpeg);
			byte[] array = new byte[memoryStream.Length];
			memoryStream.Position = 0L;
			memoryStream.Read(array, 0, array.Length);
			memoryStream.Flush();
			StringBuilder stringBuilder = new StringBuilder(50);
			if (IntPtr.Size == 4)
			{
				Wrapper.uu_recognizeByCodeTypeAndBytes(array, array.Length, 1004, stringBuilder);
			}
			else
			{
				Wrapper64.uu_recognizeByCodeTypeAndBytes(array, array.Length, 1004, stringBuilder);
			}
			memoryStream.Close();
			memoryStream.Dispose();
			return stringBuilder.ToString().Split(new char[]
			{
				'_'
			})[1];
		}
	}
}
